new Vue({
    el:"#login",
    data:{
        username:"",
        password:"",
    },
    methods:{
        login:function () {
            $.ajax({
                type:"post",
                url: "/login",
                contentType:'application/x-www-form-urlencoded',
                dataType:"json",
                async:true,
                data:{
                    username:this.username,
                    password:this.password,
                },
                success:function(result){
                    console.log(result.children[0].name)
                    alert("登录成功!")
                    if (result.children[0].name === "柜员") {
                        window.location.href="/clientIndex.html"
                    }else{
                        window.location.href="/index.html"
                    }
                },
                error:function(error){
                    alert("帐号或密码错误!")
                }
            });
        },


    }
})